<script>
import Vue from 'vue'
import store from './store'
export default {
	onLaunch: function () {
		const updateManager = wx.getUpdateManager()
		updateManager.onCheckForUpdate(function (res) {
			// 请求完新版本信息的回调
			if (res.hasUpdate) {
			}
		})

		updateManager.onUpdateReady(function () {
			wx.showModal({
				title: '更新提示',
				content: '版本已更新，请重启小程序',
				showCancel: false,
				success: function (res) {
					if (res.confirm) {
						// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
						updateManager.applyUpdate()
						console.log('重启应用')
					}
				}
			})
		})
		updateManager.onUpdateFailed(function () {
			// 新版本下载失败
			console.log('更新失败')
		})
		// console.log('App Launch')
		const windowInfo = wx.getWindowInfo()
		const deviceInfo = wx.getDeviceInfo()
		// #ifdef MP-WEIXIN || MP-QQ
		Vue.prototype.StatusBar = windowInfo.statusBarHeight
		Vue.prototype.windowHeight = windowInfo.windowHeight
		Vue.prototype.windowWidth = windowInfo.windowWidth
		Vue.prototype.TheSystem = deviceInfo.system
		Vue.prototype.ThePlatform = deviceInfo.platform
		let capsule = wx.getMenuButtonBoundingClientRect()
		if (capsule) {
			Vue.prototype.Custom = capsule
			// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
			Vue.prototype.CustomBar = capsule.bottom + capsule.top - windowInfo.statusBarHeight
		} else {
			Vue.prototype.CustomBar = windowInfo.statusBarHeight + 50
		}
		// #endif
		// uni.getSystemInfo({
		// 	success: function (e) {
				
		// 	}
		// })
	},
	onShow: function () {
		// #ifdef MP-WEIXIN
		uni.setInnerAudioOption({
			obeyMuteSwitch: false
		})
		// #endif
		console.log('App Show')
		if(uni.getStorageSync('Access-Token')){
			store.dispatch('saveSystemInfo')
		}
	},
	onHide: function () {
		console.log('App Hide')
	}
}
</script>

<style>
/* @import "plugin/colorui/main.css"; */
/* @import "plugin/colorui/icon.css"; */
/* @import "plugin/colorui/animation.css"; */
@import 'plugin/iconfont/iconfont.css';
/*每个页面公共css */
@import './common/uni.css';
page {
	height: 100%;
}
.xdf-loading {
	height: 100vh;
	width: 100%;
	background-color: #ffffff;
	display: flex;
	position: fixed;
	left: 0;
	top: 0;
	align-items: center;
	justify-content: center;
	z-index: 10000;
}
.xdf-loading img {
	width: 150px;
	height: 150px;
}
checkbox.mycheck .wx-checkbox-input,
checkbox.mycheck .uni-checkbox-input {
	/* width: 40rpx !important; */
	/* height: 40rpx !important; */
	/* background-color: #eeeeee !important; */
	border-radius: 100upx !important;
	/* border: solid 1px #cccccc !important; */
	border: solid 2rpx #ccc;
}

// 选中后的 对勾样式
checkbox.mycheck[checked] .wx-checkbox-input,
checkbox.mycheck.checked .uni-checkbox-input {
	/* background-color: #ffffff !important;   //背景 */
	/* border-color: #ffffff !important;   //边框 */
	/* color: #ffffff !important;   //对勾 */
}

/* uni-app中的条件判断语句 */
/* #ifdef APP-PLUS  || H5 */
uni-swiper .uni-swiper-dot {
	width: 15rpx;
	height: 8rpx;
}
uni-swiper .uni-swiper-dot-active {
	width: 15rpx;
	border-radius: 4rpx;
}
/* #endif */

/* #ifdef MP-WEIXIN */
wx-swiper .wx-swiper-dot {
	width: 15rpx;
	height: 8rpx;
}

wx-swiper .wx-swiper-dot-active {
	width: 15rpx;
	height: 8rpx;
	border-radius: 4rpx;
}
/* #endif */
</style>
